home
***
CD-ROM
|
disk
|
FTP
|
other
***
search
/
Libris Britannia 4
/
science library(b).zip
/
science library(b)
/
PROGRAMM
/
DB_CLIPP
/
0669.ZIP
/
MOUSE.PRG
< prev
next >
Wrap
Text File
|
1987-08-11
|
3KB
|
127 lines
* mouse.prg
* derived from Turbo Prolog program mouse.pro
* requires inter.bin
* Andrew Schulman, 12 Humboldt Street, Cambridge MA 02140, 617-876-2102
* 8/11/87
* tested in dBase III Plus and FoxBase+ 2.0
if .not. file("inter.bin")
? "This program requires INTER.BIN and a Microsoft-" + ;
"compatible mouse"
return
endif
set talk off
set echo off
set scoreboard off
load inter
beeper = .f.
if file("beep.bin")
load beep
beeper = .t.
endif
set proc to mouse
do main
set proc to
proc main
okay = .f.
do ms_init
if .not. okay
? "Can't find MOUSE"
return
endif
clear
@ 1,0 say "INTER.BIN LETS YOU DO MICROSOFT MOUSE (INT 51) PROGRAMMING" + ;
" IN dBASE"
@ 2,0 say "Click the RIGHT mouse button (or select Quit) when done"
@ 3,0 to 3,78 double
do menu with 0
@ 5,0 to 5,78 double
do ms_show
store 0 to row,col,button
do while (button <> 2) && right button to quit
do ms_stat
if (beeper .and. row > 3 .and. button = 1) && left button
call beep with str(col*row) + " 4"
endif
if (button = 1 .and. row = 4) && in the menu bar
do menu with iif(col>=00 .and. col<11, 1, ;
iif(col>=11 .and. col<22, 2, ;
iif(col>=22 .and. col<35, 3, 4)))
endif
enddo
@ 20,0 say "Done! Remember, you can do all sorts of neat things with" + ;
" INTER.BIN"
do ms_hide
return
proc ms_init
ax = 0
do inter with 51,ax,0,0,0
if (ax <> 0)
okay = .t.
endif
return
proc ms_show
do inter with 51,1,0,0,0
return
proc ms_hide
do inter with 51,2,0,0,0
return
proc ms_stat
* left button = 1, right button = 2, no button down = 0
* both buttons down = 3
store 0 to button,col,row
do inter with 51,3,button,col,row
col = col / 8
row = row / 8
return
proc ms_setpos
param row,col
do inter with 51,4,(col*8),(row*8),0
return
proc inter
param intno,ax,bx,cx,dx
cmd = ltrim(str(intno)+str(ax)+str(bx)+str(cx)+str(dx))+space(10)
call inter with cmd
* parse return string into registers
ax=int(val(substr(cmd,1,5)))
bx=int(val(substr(cmd,7,5)))
cx=int(val(substr(cmd,13,5)))
dx=int(val(substr(cmd,19,5)))
return
proc menu
param which
@ 4,0 say "Menu 1 "
@ 4,11 say "Menu 2 "
@ 4,22 say "Menu 3 "
@ 4,35 say "Quit"
@ 20,0 clear to 20,78
do case
case (which = 1)
@ 4,0 say "MENU ONE"
@ 20,0 say "You clicked on menu number one"
case (which = 2)
@ 4,11 say "MENU TWO"
@ 20,0 say "You selected the second menu item"
case (which = 3)
@ 4,22 say "MENU THREE"
@ 20,0 say "You picked the third menu"
case (which = 4)
@ 4,35 say "QUIT!"
button = 2
endcase
return